package com.itheima.map;

import java.util.HashMap;
import java.util.Map;

/*
Map的增删改查
 */
public class Demo02 {

    public static void main(String[] args) {

      Map<String, String> map = new HashMap<>();
        map.put("宝强","马蓉");
        map.put("宋喆","马蓉");
        map.put("乃亮","小璐");
        map.put("PGone","小璐");

        //
        map.remove("宝强");
        System.out.println(map);

        map.put("乃亮","美女");
        System.out.println(map);

        String pGone = map.get("PGone");
        System.out.println(pGone);


        System.out.println(map.containsKey("马蓉"));
        System.out.println(map.containsKey("宋喆"));
        System.out.println(map.containsValue("马蓉"));
        System.out.println(map.containsValue("宋喆"));

        System.out.println(map.size());
        System.out.println(map.isEmpty());
        map.clear();
        System.out.println(map.size());
        System.out.println(map.isEmpty());


    }
}
